<template>
  <div>
    <el-form label-position="left" label-width="120px" style="width:100%;">
      <el-form-item label="车牌号：">{{ formData.plateNumber }}</el-form-item>
      <el-form-item label="订单开始时间：">{{ formData.beginTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}</el-form-item>
      <el-form-item label="订单结束时间：">{{ formData.endTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}</el-form-item>
      <!--      <el-form-item label="订单开始经度：">{{ formData.beginLng }}</el-form-item>
      <el-form-item label="订单开始纬度：">{{ formData.beginLat }}</el-form-item>
      <el-form-item label="订单结束经度：">{{ formData.endLng }}</el-form-item>
      <el-form-item label="订单结束纬度：">{{ formData.endLat }}</el-form-item> -->
      <el-form-item label="订单里程：">{{ formData.distance }}</el-form-item>
      <el-form-item label="接收时间：">{{ formData.recieveTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}</el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button icon="el-icon-close" @click="cancel">取消</el-button>
    </div>
  </div>
</template>
<script>
import { getOrderDetail } from '@/api/order';
import waves from '@/directive/waves';

export default {
  name: 'OrderView',
  directives: { waves },
  props: {
    id: {
      type: Number,
      default: null
    }
  },
  data() {
    return {
      confirmLoading: false,
      formData: {
      }
    };
  },
  created() {
    if (this.id) {
      this.getDetail(this.id);
    }
  },
  methods: {
    async getDetail(id) {
      await getOrderDetail(id).then(response => {
        this.formData = response.data;
      });
    },
    cancel() {
      this.$emit('cancelClose', false, 'order');
    }
  }
};
</script>
